#include "DownloadThread.h"


DownloadThread::DownloadThread(void)
{
}


DownloadThread::~DownloadThread(void)
{
}

void DownloadThread::Worker()
{
	m_nAccuByte = 0;
	for (;;)
	{
		if ((m_nReadByte =recv( m_nSocket, m_cFileBuf, 4096, 0)) <= 0)
			break;
		fwrite( m_cFileBuf, sizeof(char), m_nReadByte, m_pf  );
		m_nAccuByte += m_nReadByte;
		m_pkProgressCtrl->SetPos(m_nAccuByte);
	}
	Close();
	AfxMessageBox("File Transfer has done");
	Stop();
}